package org.cainiao.basic.collection.listqueue;

import java.util.concurrent.LinkedTransferQueue;

public class LinkedTransferQueueTest {

    public static void main(String[] args) throws InterruptedException {
        LinkedTransferQueue<String> strings = new LinkedTransferQueue<>();

        new Thread(() -> {
            try {
                System.out.println(strings.take());
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();

        new Thread(() -> {
            try {
                Thread.sleep(1000);
                System.out.println(strings.take());
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();

        strings.transfer("aaa");
        strings.put("bbb");
        strings.transfer("bbb");
        System.out.println("main() >>> end");
    }

}
